﻿@inherits AdminCompontentBase

<DefaultSheetDialog Value="Visible" ValueChanged=UpdateVisible Title="@T("Edit ApiScope")">
    <MForm Model=ApiScope EnableValidation EnableI18n>
        <AutoHeight Overflow>
            <AutoHeightContent>
                <DefaultTitle Class="mb-4">@T("BasicInformation")</DefaultTitle>
                <MRow Class="mb-6">
                    <MCol>
                        <STextField @bind-Value="ApiScope.DisplayName" Required Label="@T("DisplayName")" />
                    </MCol>
                    <MCol>
                        <STextField Disabled Value="ApiScope.Name" Required Label="@T("Name")" />
                    </MCol>
                </MRow>
                <MRow Class="mb-6">
                    <MCol>
                        <STextField @bind-Value="ApiScope.Description" Label="@T("Description")" />
                    </MCol>
                </MRow>
                <div class="d-flex mb-10">
                    <MCheckbox @bind-Value="ApiScope.Required" Class="pt-0 mt-0" Label="@T(nameof(ApiScope.Required))" HideDetails="@("auto")" TValue="bool"/>
                    <MCheckbox @bind-Value="ApiScope.Emphasize" Class="ml-12 pt-0 mt-0" Label="@T(nameof(ApiScope.Emphasize))" HideDetails="@("auto")" TValue="bool" />
                    <MCheckbox @bind-Value="ApiScope.ShowInDiscoveryDocument" Class="ml-12 pt-0 mt-0" Label="@T(nameof(ApiScope.ShowInDiscoveryDocument))" HideDetails="@("auto")" TValue="bool" />
                </div>            
                <DefaultTitle Class="mb-2">@T("User Claims")</DefaultTitle>
                <UserClaimSelect @bind-Value=ApiScope.UserClaims />
            </AutoHeightContent>
            <FooterContent>
                <div Class="d-flex mt-6">
                    <EnableSwitch @bind-Value="ApiScope.Enabled" />
                    <MSpacer></MSpacer>
                    <SButton Medium OnClick="async () => await UpdatetApiScopeAsync(context)">@T("Save")</SButton>
                </div>
            </FooterContent>
        </AutoHeight>
    </MForm>
</DefaultSheetDialog>